home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2002 January / maximum-cd-2002-01.iso / Files / Mechwarrior 4 Mapping / MW4Editor.exe / content / ABLScripts / Bots / KillerBot.abl < prev    next >
Encoding:
Text File  |  2001-07-16  |  2.7 KB  |  107 lines

  1.  
  2. fsm KillerBot : integer;
  3.  
  4.  
  5. //------------------------------------------------------------------
  6.  
  7. // KillerBot:
  8. //   A medium-level challenge: tougher than a RookieBot, less than
  9. //   a SlaughterBot.
  10.  
  11. //------------------------------------------------------------------
  12.  
  13.  
  14. //------------------------------------------------------------------
  15. //     Constants
  16. //------------------------------------------------------------------
  17.  
  18.     const
  19.         #include_ <content\ABLScripts\mwconst.abi>
  20.  
  21. //------------------------------------------------------------------
  22. //     Types
  23. //------------------------------------------------------------------
  24.  
  25.     type
  26.         #include_ <content\ABLScripts\mwtype.abi>
  27.     
  28.  
  29. //------------------------------------------------------------------
  30. //     Variables
  31. //------------------------------------------------------------------
  32.  
  33.     var
  34.         static integer            attackRange;        // At what range do I start shooting?
  35.         static integer            withdrawRange;        // At what range do I withdraw?
  36.  
  37. //------------------------------------------------------------------
  38. //     Init: my initialization function
  39. //------------------------------------------------------------------
  40.  
  41. function Init;
  42.     code
  43.         // script-specific variables
  44.         attackRange        = 9999;
  45.         withdrawRange    = 9999;
  46.  
  47.         // driver settings
  48.         SetIgnoreFriendlyFire    (ME,true);
  49.         SetFiringDelay            (ME,0.0,2.5);
  50.         SetIsShotRadius            (ME,160);
  51.         SetEntropyMood            (ME,NEUTRAL_END);
  52.         SetCurMood                (ME,NEUTRAL_END);
  53.         SetSkillLevel            (ME,80,70,80);
  54.         SetAttackThrottle        (ME,85);
  55. endfunction;
  56.  
  57. //------------------------------------------------------------------
  58. //    StartState: my initial state
  59. //------------------------------------------------------------------
  60.  
  61. state StartState;
  62.  
  63.     code
  64.         trans WaitToAmbushState;
  65.  
  66. endstate;
  67.  
  68. //------------------------------------------------------------------
  69. //    WaitInAmbushState: wait for someone to come close enough to attack
  70. //------------------------------------------------------------------
  71.  
  72. state WaitToAmbushState;
  73.     code
  74.         if (Bot_FindEnemy(attackrange)) then
  75.             trans AttackState;
  76.         endif;
  77.  
  78.         OrderMoveLookOut;
  79. endstate;
  80.  
  81. //------------------------------------------------------------------
  82. //    AttackState: the ambush is over -- let's kick some ass!
  83. //------------------------------------------------------------------
  84.  
  85. state AttackState;
  86.     code
  87.         if (LeaveAttackState(withdrawRange)) then
  88.             trans WaitToAmbushState;
  89.         endif;
  90.  
  91.         OrderAttack(TRUE);
  92. endstate;
  93.  
  94. //------------------------------------------------------------------
  95. //    DeadState: OK, I kicked the bucket.
  96. //------------------------------------------------------------------
  97.  
  98. state DeadState;
  99.     code
  100.         orderDie;
  101.  
  102. endstate;
  103.  
  104.  
  105. endfsm.
  106.  
  107.